package com.gin.supermarket_inventory_system.commodity.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.gin.database.base.BasePo;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.Comment;

/**
 * 商品类型
 * @since : 2023/10/8 17:53
 * @author : ginstone
 * @version : v1.0.0
 **/
@Getter
@Setter
@TableName(value = CommodityTypePo.TABLE_NAME, autoResultMap = true)
@Entity(name = CommodityTypePo.TABLE_NAME)
@NoArgsConstructor
@Table(uniqueConstraints = {
        @UniqueConstraint(name="name_parent",columnNames = {"name","parentId"})
})
public class CommodityTypePo extends BasePo {
    protected static final String TABLE_NAME = "tb_commodity_entity_type";

    @Column(nullable = false,unique = true)
    @Comment("名称")
    String name;

    @Column
    @Comment("父类型Id")
    Long parentId;

}